<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册博客用户</title>
    <link th:href="@{/js/el/element.css}" rel="stylesheet" type="text/css"/>
    <script th:src="@{/js/vue.js}" type="text/javascript"></script>
    <script th:src="@{/js/el/element.js}" type="text/javascript"></script>
    <script th:src="@{/js/axios.js}" type="text/javascript"></script>

    <style>
        .myAddUser {
            width: 500px;
            /*绝对定位的方式*/
            position: absolute;
            /*定位div的位置*/
            left: 50%;
            top: 40%;
            transform: translate(-40%, -60%);
            /*内边距*/
            padding-top: 20px;
            padding-left: 10px;
            padding-right: 10px;
        }
    </style>
</head>
<body>
<div id="app" style="margin-left: 2vw;margin-right: 2vw;">

    <div class="myAddUser">
        <h2 style="text-align: center">&nbsp;添加博客类别&nbsp;</h2>
        <el-divider></el-divider>
        <div>
            <el-input id="name" v-model="blogType.typename" placeholder="请输入博客类别名称">
                <template slot="prepend"><i class="el-icon-s-custom"></i></template>
            </el-input>
        </div>
        <div style="margin-top: 30px;">
            <el-button id="login" v-on:click="addBlogtype()" style="width:100%" type="primary" plain>添加</el-button>
        </div>
        <div style="margin-top: 30px;">
            <el-button id="login" v-on:click="go2Index()" style="width:100%" type="primary" plain>返回首页</el-button>
        </div>
        <hr>

    </div>

</div>
</body>
<script>
    new Vue({
        el: '#app',
        data: {
            blogType:{}
        },
        methods: {
            //添加博客类别
            addBlogtype() {
                var that = this
                axios.post("/api/adm/addBlogType", this.blogType).then(function (resp) {
                    if (resp.data.code == 200) {
                        that.$message({
                            showClose: true,
                            offset: 100,
                            message: resp.data.msg,
                            type: 'success'
                        });

                    }

                })
            },
            go2Index(){
                window.location.href="/api/public/go2Index"
            }
        },
        mounted: function () {


        }
    })
</script>
</html>